//
//  UIView+IBInspectable.swift
//  MYSinaWeico
//
//  Created by Magic Yu on 16/4/7.
//  Copyright © 2016年 Magic Yu. All rights reserved.
//
/*
@IBInspectable 为xib/storyBoard添加可视化属性
@IBDesignable  使属性可以实时显示
*/

import UIKit


extension UIView {

    @IBInspectable var cornerRadius: CGFloat {
        
        get {
        return layer.cornerRadius
        }
        
        set {
        layer.cornerRadius = newValue
            layer.masksToBounds = true
//            if newValue > 0 {
//            layer.masksToBounds = true
//            }else {
//            layer.masksToBounds = false
//            }
            
        }
        
    }
    
    @IBInspectable var borderWidth: CGFloat {
    
        get {
        return layer.borderWidth
        }
        
        set {
            layer.borderWidth = newValue
        }
    }
    
    @IBInspectable var borderColor: UIColor? {
    
        get {
            if let c = layer.borderColor {
            return UIColor(CGColor: c)
            }
            return nil
        }
        
        set {
        layer.borderColor = newValue?.CGColor
        }
    }
    
}








